<meta charset="utf-8">
<?php

include_once($_SERVER['DOCUMENT_ROOT']."/ExiaStore/Model/verificationBDD.php");
include_once($_SERVER['DOCUMENT_ROOT']."/ExiaStore/Model/BDD.php");

if(!verifConnexion(new BDD()))
{
    echo "<script> alert('Identifiants incorrects') </script>";
    header("Refresh: 0; URL=index.php");
}
else
{ 
    session_start();
    $_SESSION['login']=$_POST['login'];

    if($_SESSION['login']=='admin')
    {
    $_SESSION['admin']=$_POST['login']; 
    echo "<script> alert('Vous êtes co en admin !') </script>"; 
    header("Refresh: 0; URL=../View/admin.php");  
    }
    else 
    {
    echo "<script> alert('Vous êtes connecté !') </script>"; 
    header("Refresh: 0; URL=index.php");  
    }

}


?>